package com.yanmaohu.yulia.bean;

/**
 * @author Bright Lee
 */
public final class WindowFrameClause {

    private int beginIndex;
    private int endIndex;
    private WindowFrameUnits windowFrameUnits;
    private WindowFrameExtent windowFrameExtent;
    private WindowFrameExclusion windowFrameExclusion;

    public WindowFrameClause(WindowFrameUnits windowFrameUnits,
                             WindowFrameExtent windowFrameExtent,
                             WindowFrameExclusion windowFrameExclusion) {
        this.beginIndex = windowFrameUnits.getBeginIndex();
        if (windowFrameExclusion != null) {
            this.endIndex = windowFrameExclusion.getEndIndex();
        } else {
            this.endIndex = windowFrameExtent.getEndIndex();
        }
        this.windowFrameUnits = windowFrameUnits;
        this.windowFrameExtent = windowFrameExtent;
        this.windowFrameExclusion = windowFrameExclusion;
    }

    public int getBeginIndex() {
        return beginIndex;
    }

    public int getEndIndex() {
        return endIndex;
    }

    public WindowFrameUnits getWindowFrameUnits() {
        return windowFrameUnits;
    }

    public WindowFrameExtent getWindowFrameExtent() {
        return windowFrameExtent;
    }

    public WindowFrameExclusion getWindowFrameExclusion() {
        return windowFrameExclusion;
    }

}
